<template>
  <div class="company-user-list" v-show="isShow">
    <ul class="global-operation-list">
      <li class="global-operation-left">
        <ul class="global-filter-list">
          <li
            class="global-filter-item"
            v-if="
              userInfo.role &&
              (userInfo.role.includes(40) || userInfo.role.includes(55))
            "
          >
            <el-button
              :type="!btnStatus ? 'danger' : 'primary'"
              class="global-filter-item-search"
              @click="searchTimeOut"
              >待处理</el-button
            >
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">关键字：</h2>
            <el-input
              placeholder="客户公司名称、项目或品名"
              v-model="searchForm.keyword"
              style="width: 250px"
              clearable
              @change="getPost"
            ></el-input>
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">品类：</h2>
            <el-select
              v-model="searchForm.cateIds"
              clearable
              filterable
              @visible-change="visibleChangeCateIds"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in cateList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">区域：</h2>
            <el-select
              v-model="searchForm.areaId"
              clearable
              @visible-change="visibleChangeArea"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in areaList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li
            class="global-filter-item"
            v-if="
              userInfo.role &&
              !userInfo.role.includes(40) &&
              !userInfo.role.includes(55)
            "
          >
            <h2 class="global-filter-item-title">商务：</h2>
            <el-select
              v-model="searchForm.businessId"
              clearable
              filterable
              @visible-change="visibleChangeBussiness"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in bussinessUserList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item" v-if="!modelStatus">
            <h2 class="global-filter-item-title">状态：</h2>
            <el-select
              v-model="searchForm.status"
              clearable
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in statusList"
                :key="index"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">执行进度：</h2>
            <el-select
              v-model="searchForm.executionProgressId"
              clearable
              filterable
              @visible-change="visibleChangeExecutionProgress"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in executionProgressList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">到货进度：</h2>
            <el-select
              v-model="searchForm.arrivalProgressId"
              clearable
              filterable
              @visible-change="visibleChangeArrivalProgress"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in arrivalProgressList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item">
            <h2 class="global-filter-item-title">到货仓库：</h2>
            <el-select
              v-model="searchForm.arrivalWarehouseId"
              clearable
              filterable
              @visible-change="visibleChangeArrivalWarehouse"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in arrivalWarehouseList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </li>
          <li class="global-filter-item">
            <el-button
              type="primary"
              class="global-filter-item-search"
              @click="rePosts"
              >搜索</el-button
            >
          </li>
          <li class="global-filter-item">
            <el-button
              type="primary"
              class="global-filter-item-search"
              v-if="operationList.includes('add')"
              @click="add"
              >添加</el-button
            >
          </li>
          <li class="global-filter-item" v-if="searchChooseProjectName">
            <div style="display: flex">
              已选择的项目：{{ searchChooseProjectName }}
              <div
                @click="goCleanSearchProject"
                style="cursor: pointer; padding-left: 10px"
              >
                <i class="el-icon-circle-close"></i>
              </div>
            </div>
          </li>
        </ul>
      </li>
    </ul>
    <div class="global-table-content">
      <div class="global-table-content-a">
        <!-- <div>
                    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelectMenu">
                        <el-menu-item index="10">全部</el-menu-item>
                        <el-menu-item index="1">创建中</el-menu-item>
                        <el-menu-item index="2">选品核价中</el-menu-item>
                        <el-menu-item index="3">沟通中</el-menu-item>
                        <el-menu-item index="4">已签单执行中</el-menu-item>
                        <el-menu-item index="5">执行完</el-menu-item>
                        <el-menu-item index="9">已黄单</el-menu-item>
                    </el-menu>
                </div> -->
        <el-table
          :data="dataList"
          style="width: 100%"
          :row-style="{ height: '0' }"
          :cell-style="{ padding: '3px' }"
          max-height="620"
          border
          v-loading="tableLoading"
        >
          <el-table-column
            prop="projectName"
            label="客户公司名称"
            show-overflow-tooltip
            width="150"
          ></el-table-column>
          <el-table-column
            prop="name"
            label="项目名称"
            show-overflow-tooltip
            width="100"
          >
            <template slot-scope="scope">
              <el-button type="text" @click="handlego(scope.row.id)">{{
                scope.row.name
              }}</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="brands"
            label="品牌"
            show-overflow-tooltip
            width="120"
          >
          </el-table-column>
          <el-table-column
            prop="brandsUsername"
            label="客户负责人"
            show-overflow-tooltip
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="cates"
            label="品类"
            show-overflow-tooltip
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="productName"
            label="品名"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.status
                    ? scope.row.status == 1
                      ? "创建中"
                      : scope.row.status == 2
                        ? "核价中-未分配给渠道"
                        : scope.row.status == 3
                          ? "跟进中"
                          : scope.row.status == 4
                            ? "已签单"
                            : scope.row.status == 5
                              ? "执行完"
                              : scope.row.status == 6
                                ? "核价中-已分配未反馈"
                                : scope.row.status == 7
                                  ? "核价中-已反馈未确认"
                                  : scope.row.status == 9
                                    ? "已黄单"
                                    : "-"
                    : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="pushUserName"
            label="推送详情"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <el-popover placement="top-start" width="400" trigger="click">
                <el-descriptions title="推送详情" :column="1">
                  <el-descriptions-item label="推送开拓者">{{
                    scope.row.pushUserName
                  }}</el-descriptions-item>
                  <el-descriptions-item label="推送助理">{{
                    scope.row.pushAssistantName
                  }}</el-descriptions-item>
                </el-descriptions>
                <el-descriptions
                  title="转推详情"
                  :column="1"
                  v-if="scope.row.isNextPush == 2"
                >
                  <el-descriptions-item label="转推开拓者">
                    <div
                      v-for="(item, index) in scope.row.nextPushUserNames"
                      :key="index"
                    >
                      {{ item }}
                    </div>
                  </el-descriptions-item>
                  <el-descriptions-item label="转推助理">
                    <div
                      v-for="(item, index) in scope.row.nextPushAssistantNames"
                      :key="index"
                    >
                      {{ item }}
                    </div>
                  </el-descriptions-item>
                </el-descriptions>
                <el-button slot="reference" type="text">
                  <div style="display: inline-flex">
                    <div>{{ scope.row.pushUserName }}</div>
                    <div
                      v-if="scope.row.isNextPush == 2"
                      style="padding-left: 5px; display: inline-flex"
                    >
                      转推对象：
                      <div
                        v-for="(item, index) in scope.row.nextPushUserNames"
                        :key="index"
                      >
                        {{ item }}
                      </div>
                    </div>
                  </div>
                </el-button>
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column
            prop="bussinessUsername"
            label="商务"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="areas"
            label="区域"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="permissionUsername"
            label="执行负责人"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="totalProjectNum"
            label="总数量"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="totalProjectPrice"
            label="总货值"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="innerTotalPrice"
            label="内部货值"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="createDate"
            label="创建时间"
            show-overflow-tooltip
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="checkDate"
            label="签单时间"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>{{ scope.row.checkDate ? scope.row.checkDate : "--" }}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="finalDate"
            label="完成执行时间"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>{{ scope.row.finalDate ? scope.row.finalDate : "--" }}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="actualValuePrice"
            label="实际货值"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.actualValuePrice ? scope.row.actualValuePrice : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="executionProgress"
            label="执行进度"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.executionProgress
                    ? scope.row.executionProgress
                    : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="arrivalProgress"
            label="到货状态"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.arrivalProgress ? scope.row.arrivalProgress : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="arrivalInnerPrice"
            label="到货内部货值"
            show-overflow-tooltip
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="arrivalWarehouse"
            label="到货仓库"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.arrivalWarehouse ? scope.row.arrivalWarehouse : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="goodArrivalStatus"
            label="到货进度"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{
                  scope.row.goodArrivalStatus
                    ? scope.row.goodArrivalStatus
                    : "--"
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="goodArrivalMsg"
            label="到货详情"
            show-overflow-tooltip
            width="150"
          >
            <template slot-scope="scope">
              <div>
                {{ scope.row.goodArrivalMsg ? scope.row.goodArrivalMsg : "--" }}
              </div>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="130">
            <template slot-scope="scope">
              <div
                style="
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                "
              >
                <el-dropdown @command="handleCommand($event, scope.row)">
                  <span
                    class="el-dropdown-link"
                    :style="{
                      color: $store.state.theme.theme_color || '#03C192',
                      cursor: 'pointer',
                    }"
                  >
                    操作
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <!-- <el-dropdown-item command="package" v-if="operationList.includes('package') ">{{
                                            scope.row.isPackage && scope.row.isPackage == 2 ? '修改配包' : '配包'
                                            }}</el-dropdown-item> -->
                    <el-dropdown-item
                      command="handleAddOrder"
                      v-if="operationList.includes('order:add')"
                      >添加订单</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="handleViewOrder"
                      v-if="operationList.includes('order:view')"
                      >查看订单</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="handleAddIntendedMedia"
                      v-if="operationList.includes('addIntendedMedia')"
                      >选择报备媒体</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="handleViewIntendedMedia"
                      v-if="operationList.includes('projectIntendedMedia:view')"
                      >查看报备媒体</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="handleViewMediaRequirements"
                      v-if="
                        operationList.includes('projectMediaRequirements:list')
                      "
                      >查看媒体需求</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="handleViewProjectFile"
                      v-if="operationList.includes('projectFile:view')"
                      >文件管理</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="showContract"
                      v-if="
                        operationList.includes('editContract') &&
                        scope.row.contractUrl
                      "
                      >查看合同</el-dropdown-item
                    >
                    <el-dropdown-item command="edit" v-if="userInfo.role"
                      >查看</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="editContract"
                      v-if="operationList.includes('editContract')"
                      >{{
                        scope.row.contractUrl ? "编辑合同" : "上传合同"
                      }}</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="editDiscount"
                      v-if="operationList.includes('editDiscount')"
                      >是否打折</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="fail"
                      v-if="
                        operationList.includes('fail') && scope.row.status != 9
                      "
                      >黄单</el-dropdown-item
                    >
                    <el-dropdown-item
                      command="del"
                      v-if="operationList.includes('edit')"
                      >删除</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>

                <el-button
                  type="primary"
                  size="mini"
                  plain
                  @click="handlego(scope.row.id)"
                  >详情</el-button
                >
              </div>
              <!-- <div v-if="operationList.includes('package')">
                                <el-button @click="handlePackage(scope.row.id, scope.row.brands, scope.row.projectName)" type="text" size="small">{{ scope.row.isPackage && scope.row.isPackage == 2 ? '修改配包' : '配包' }}</el-button>
                            </div>
                            <div v-if="operationList.includes('order:add')">
                                <el-button @click="handleAddOrder(scope.row)" type="text" size="small">添加订单</el-button>
                            </div>
                            <div v-if="operationList.includes('order:view')">
                                <el-button @click="handleViewOrder(scope.row)" type="text" size="small">查看订单</el-button>
                            </div>
                            <div v-if="operationList.includes('editContract') && scope.row.contractUrl">
                                <el-button @click="showContract(scope.row)" type="text" size="small">查看合同</el-button>
                            </div> -->
            </template>
          </el-table-column>
        </el-table>
        <div class="global-page">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            :current-page="pageNum"
            background
            layout="sizes, total, prev, pager, next"
            :total="total"
          >
          </el-pagination>
        </div>
      </div>
    </div>

    <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
      <!-- <el-steps :active="stepac" finish-status="success">
                <el-step title="步骤 1"></el-step>
                <el-step title="步骤 2"></el-step>
                <el-step title="步骤 3"></el-step>
              </el-steps> -->

      <el-form :model="form" :rules="rules" ref="ruleForm">
        <el-card v-if="stepfirst">
          <el-form-item
            label="区域"
            prop="areaIds"
            :label-width="formLabelWidth"
          >
            <el-select
              v-model="form.areaIds"
              placeholder="请选择"
              @change="changeArea"
              :disabled="
                userInfo.role &&
                (userInfo.role.includes(40) || userInfo.role.includes(55))
              "
            >
              <el-option
                v-for="(item, index) in areaList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="商务"
            prop="bussinessUsername"
            :label-width="formLabelWidth"
            v-if="form.areaIds"
          >
            <el-select
              v-model="form.bussinessUsername"
              placeholder="请选择"
              @change="changeBusiness"
              filterable
              :disabled="
                userInfo.role &&
                (userInfo.role.includes(40) || userInfo.role.includes(55))
              "
            >
              <el-option
                v-for="(item, index) in bussinessUserList"
                :key="index"
                :label="item.sysValueName"
                :value="item.sysValueName"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="品牌"
            prop="brands"
            :label-width="formLabelWidth"
          >
            <el-select
              v-model="form.brands"
              placeholder="请选择品牌"
              @change="changeBrands"
              filterable
            >
              <el-option
                v-for="(item, index) in brandsList"
                :key="index"
                :label="item.brandsName"
                :value="item.brandsName"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="项目类型"
            prop="projectType"
            :label-width="formLabelWidth"
          >
            <el-select
              v-model="form.projectType"
              placeholder="请选择项目类型"
              filterable
            >
              <el-option
                v-for="(item, index) in projectTypeList"
                :key="index"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="项目名称"
            prop="name"
            :label-width="formLabelWidth"
          >
            <el-input
              v-model="form.name"
              autocomplete="off"
              @input="doGetHasAddProjectName"
              id="asNameInp"
            ></el-input>
            <div v-if="sureLoading" style="color: red">项目名称已被添加</div>
          </el-form-item>
          <!-- <el-form-item label="客户公司名称" prop="projectName" :label-width="formLabelWidth">
                    <el-input v-model="form.projectName" autocomplete="off"></el-input>
                </el-form-item> -->
          <el-form-item
            label="客户负责人"
            prop="brandsUsername"
            :label-width="formLabelWidth"
          >
            <el-input
              v-model="form.brandsUsername"
              autocomplete="off"
              :disabled="form.brands!==''"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="品名"
            prop="productName"
            :label-width="formLabelWidth"
          >
            <el-input v-model="form.productName" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item
            label="品类"
            prop="cateIdList"
            :label-width="formLabelWidth"
          >
            <el-select
              v-model="form.cateIdList"
              placeholder="请选择"
              multiple
              @change="changeBrandPlacementType"
            >
              <el-option
                v-for="(item, index) in cateList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="执行负责人" prop="permissionUsername" :label-width="formLabelWidth">
                    <el-select v-model="form.permissionUsername" placeholder="请选择"
                        :disabled="userInfo.role && userInfo.role.includes(50)" filterable>
                        <el-option v-for="(item,index) in permissionUserList" :key="index" :label="item.username"
                            :value="item.username"></el-option>
                    </el-select>
                </el-form-item> -->
        </el-card>
        <el-card v-if="MediumCascadertype">
          <div slot="header" class="clearfix">
            <span>自营媒体报备需求</span>
          </div>
          <el-form-item
            label="报备媒体"
            prop="mediumIdList"
            :label-width="formLabelWidth"
          >
            <el-cascader
              :options="mediumOfflineCascaderList"
              :props="mediumOfflineCascaderProps"
              collapse-tags
              clearable
              v-model="form.mediumIdList"
              filterable
              @change="changeMediumCascader"
            ></el-cascader>
          </el-form-item>
          <el-form-item
            label="投放品牌"
            prop="brandPlacement"
            :label-width="formLabelWidth"
          >
            <el-input
              v-model="form.brandPlacement"
              @input="changeBrandPlacement"
              autocomplete="off"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="投放品牌图片"
            prop="brandPlacementPic"
            :label-width="formLabelWidth"
          >
            <el-upload
              class="avatar-uploader toufang"
              action="/checkorder/manager/pc/user/uploadFile"
              drag
              :show-file-list="false"
              :data="{ token: $store.state.token }"
              :on-success="
                (response, file, fileList) =>
                  handleAvatarSuccessBrandPlacementPic(response)
              "
            >
              <img
                v-if="form.brandPlacementPic"
                :src="form.brandPlacementPic"
                class="avatar"
              />
              <i
                v-else
                class="el-icon-plus avatar-uploader-icon"
                style="
                  height: 100px;
                  width: 100px;
                  line-height: 100px !important;
                "
              ></i>
              <div
                slot="tip"
                class="el-upload__tip"
                style="color: #919baf; display: flex"
              >
                <div>只能上传jpg/png文件，示例图（点击图片可以放大查看）：</div>
                <el-image
                  style="width: 100px; height: 100px"
                  :src="reportMediumCaseDiagramPic"
                  fit="fill"
                  :preview-src-list="[reportMediumCaseDiagramPic]"
                ></el-image>
              </div>
            </el-upload>
          </el-form-item>
        </el-card>
        <el-card v-if="mediarequirementtype">
          <div slot="header" class="clearfix">
            <span>媒体需求</span>
          </div>
          <el-form-item
            label="投放品牌"
            prop="brandPlacement"
            :label-width="formLabelWidth"
          >
            <el-input
              v-model="form.brandPlacement"
              disabled
              autocomplete="off"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="投放品牌类型"
            prop="brandPlacementType"
            :label-width="formLabelWidth"
          >
            <el-select
              v-model="form.brandPlacementType"
              clearable
              filterable
              multiple
              disabled
            >
              <el-option
                v-for="(item, index) in brandPlacementTypeList"
                :key="index"
                :label="item.sysValueName"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="资源类型"
            prop="stationType"
            :label-width="formLabelWidth"
          >
            <el-checkbox-group v-model="form.stationType">
              <el-checkbox
                v-for="item in stationTypeList"
                :key="item.value"
                :label="item.label"
              ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item
            label="媒体类型"
            prop="mediumType"
            :label-width="formLabelWidth"
          >
            <el-input v-model="form.mediumType" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="城市" prop="city" :label-width="formLabelWidth">
            <el-input v-model="form.city" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item
            label="预计上刊时间"
            prop="orderTime"
            :label-width="formLabelWidth"
          >
            <el-input v-model="form.orderTime" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item
            label="备注"
            prop="remark"
            :label-width="formLabelWidth"
          >
            <el-input v-model="form.remark" autocomplete="off"></el-input>
          </el-form-item>
        </el-card>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="submitForm"
          :disabled="sureLoading"
          :loading="sureClickLoading"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="合同" :visible.sync="contractDialogVisible" width="35%">
      <div v-if="hasShowAdd">
        <el-upload
          class="upload-demo"
          drag
          :on-success="handleAvatarSuccessFile"
          :data="{ token: $store.state.token }"
          v-loading="uploadLoading"
          :headers="{ 'Access-Control-Allow-Origin': '*' }"
          action="/checkorder/manager/pc/user/uploadFile"
          :show-file-list="false"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div> -->
        </el-upload>
      </div>
      <div style="padding-top: 20px">
        <div>
          <div
            v-for="(item, index) in fileList"
            :key="index"
            style="display: flex; padding: 10px 0"
          >
            文件{{ index + 1 }}
            <div
              style="padding-left: 15px; cursor: pointer; color: #70a7ef"
              @click="handleViewContract(index)"
            >
              查看
            </div>
            <div
              v-if="hasShowAdd"
              style="padding-left: 15px; cursor: pointer; color: #70a7ef"
              @click="delContract(index)"
            >
              删除
            </div>
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="contractDialogVisible = false">取 消</el-button>
        <!-- <el-button type="primary" @click="submit">确 定</el-button> -->
      </div>
    </el-dialog>

    <el-dialog title="实际货值" :visible.sync="actualValueDialogVisible">
      <el-input v-model="actualValuePrice" autocomplete="off"></el-input>
      <div slot="footer" class="dialog-footer">
        <el-button @click="actualValueDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitActualValuePrice"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="执行进度" :visible.sync="executionProgressDialogVisible">
      <div>
        <el-select
          v-model="executionProgressId"
          clearable
          filterable
          @visible-change="visibleChangeExecutionProgress"
          :loading="searchLoading"
        >
          <el-option
            v-for="(item, index) in executionProgressList"
            :key="index"
            :label="item.sysValueName"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="executionProgressDialogVisible = false"
          >取 消</el-button
        >
        <el-button type="primary" @click="submitExecutionProgress"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="到货进度" :visible.sync="arrivalProgressDialogVisible">
      <div>
        <el-select
          v-model="arrivalProgressId"
          clearable
          filterable
          @visible-change="visibleChangeArrivalProgress"
          :loading="searchLoading"
        >
          <el-option
            v-for="(item, index) in arrivalProgressList"
            :key="index"
            :label="item.sysValueName"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="arrivalProgressDialogVisible = false"
          >取 消</el-button
        >
        <el-button type="primary" @click="submitArrivalProgress"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="到货仓库" :visible.sync="arrivalWarehouseDialogVisible">
      <div>
        <el-select
          v-model="arrivalWarehouseId"
          clearable
          filterable
          @visible-change="visibleChangeArrivalWarehouse"
          :loading="searchLoading"
        >
          <el-option
            v-for="(item, index) in arrivalWarehouseList"
            :key="index"
            :label="item.sysValueName"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="arrivalWarehouseDialogVisible = false"
          >取 消</el-button
        >
        <el-button type="primary" @click="submitArrivalWarehouse"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="打折" :visible.sync="discountDialogVisible">
      <el-form :model="discountForm" :rules="discountRules" ref="ruleForm">
        <el-form-item
          label="是否需要打折"
          prop="isDiscount"
          :label-width="formLabelWidth"
        >
          <el-radio-group v-model="discountForm.isDiscount">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item
          label="内容"
          prop="discountContent"
          :label-width="formLabelWidth"
          v-if="discountForm.isDiscount && discountForm.isDiscount == 1"
        >
          <el-input
            type="textarea"
            v-model="discountForm.discountContent"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          label="图片"
          prop="discountPic"
          :label-width="formLabelWidth"
          v-if="discountForm.isDiscount && discountForm.isDiscount == 1"
        >
          <el-upload
            class="avatar-uploader"
            :multiple="false"
            action="/checkorder/manager/pc/user/uploadFile"
            :on-preview="handlePreview"
            :on-success="handleAvatarSuccess"
            :on-remove="handleRemove"
            :data="{ token: $store.state.token }"
            :show-file-list="false"
            accept=".jpg,.png,.jpeg,.JPG,.PNG,.JPEG"
          >
            <img
              v-if="discountForm.discountPic"
              :src="discountForm.discountPic"
              class="avatar"
            />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            <div slot="tip" class="el-upload__tip">
              只能上传jpg/png/jpeg文件
            </div>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="discountDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitUpdateDiscount"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog title="黄单原因" :visible.sync="failDialogVisible">
      <div>
        <el-input
          type="textarea"
          v-model="failReason"
          autocomplete="off"
        ></el-input>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="failDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitFail">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog
      title="配包列表"
      :visible.sync="packageDialogVisible"
      width="85%"
    >
      <ProjectPackage
        :project-id="chooseProjectId"
        :brands="chooseProjectBrands"
        :project-name="chooseProjectName"
        :package-dialog-visible-num="packageDialogVisibleNum"
      >
      </ProjectPackage>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClosePackageDialog">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog
      title="选择报备媒体"
      :visible.sync="intendedMediaDialogVisible"
      width="55%"
    >
      <div>
        <div style="display: flex; align-items: center">
          <div>项目：</div>
          <div>
            <el-input v-model="intendedMediaChooseProjectName"></el-input>
          </div>
        </div>
        <div style="padding-top: 20px; display: flex; align-items: center">
          <div>媒体：</div>
          <div>
            <el-cascader
              :options="mediumOfflineCascaderList"
              :props="mediumOfflineCascaderProps"
              collapse-tags
              clearable
              v-model="intendedMediaChooseList"
              filterable
            ></el-cascader>
          </div>
        </div>
        <div style="padding-top: 20px; display: flex; align-items: center">
          <div>报备图片：</div>
          <div>
            <el-upload
              class="avatar-uploader"
              action="/checkorder/manager/pc/user/uploadFile"
              drag
              :show-file-list="false"
              :data="{ token: $store.state.token }"
              :on-success="
                (response, file, fileList) =>
                  handleAvatarSuccessUpdateBrandPlacementPic(response)
              "
            >
              <img
                v-if="intendedMediaChooseProjectPic"
                :src="intendedMediaChooseProjectPic"
                class="avatar"
              />
              <i
                v-else
                class="el-icon-plus avatar-uploader-icon"
                style="
                  height: 100px;
                  width: 100px;
                  line-height: 100px !important;
                "
              ></i>
              <div
                slot="tip"
                class="el-upload__tip"
                style="color: #919baf; display: flex"
              >
                <div>只能上传jpg/png文件，示例图（点击图片可以放大查看）：</div>
                <el-image
                  style="width: 100px; height: 100px"
                  :src="reportMediumCaseDiagramPic"
                  fit="fill"
                  :preview-src-list="[reportMediumCaseDiagramPic]"
                ></el-image>
              </div>
            </el-upload>
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleCloseIntendedMediaDialog">取 消</el-button>
        <el-button type="primary" @click="doSubmitIntendedMedia"
          >提 交</el-button
        >
      </div>
    </el-dialog>

    <!-- 新增的上传表单弹窗 -->
    <el-dialog title="上传表单" :visible.sync="dialogVisible" width="70%">
        <el-form :model="upform" :rules="uprules" ref="upform">
          <el-form-item
            label="文件"
            prop="fileMsg"
            label-width="100px"
            label-position="right"
          >
            <el-upload
              class="upload-demo"
              drag
              :action="url"
              :on-progress="uploadFileLoading"
              :data="{ token: $store.state.token, fileType: this.upform.fileType }"
              :headers="{ 'Access-Control-Allow-Origin': '*' }"
              :show-file-list="false"
              :http-request="checkedFile"
              multiple
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处，或<em>点击上传</em>
              </div>
            </el-upload>
          </el-form-item>
  
          <el-form-item
            v-if="goodList && goodList.length > 0 && this.upform.fileType == 1"
          >
            <div class="form_table_goods">
              <el-table
                :data="goodList"
                :summary-method="getSummaries"
                show-summary
                max-height="750"
                :row-style="{ height: '0' }"
                :cell-style="{ padding: '3px' }"
                style="width: 100%"
              >
                <el-table-column prop="goodName" fixed label="商品名称">
                </el-table-column>
                <el-table-column prop="goodSkuName" fixed label="商品规格">
                </el-table-column>
                <el-table-column prop="expirationDate" label="有效期至">
                </el-table-column>
                <el-table-column prop="warrantyDate" label="保质期">
                </el-table-column>
                <el-table-column prop="goodNum" label="数量"> </el-table-column>
                <el-table-column prop="goodPrice" label="旗舰店售卖价">
                </el-table-column>
                <el-table-column
                  prop="goodOnlineLink"
                  show-overflow-tooltip
                  label="天猫/京东链接"
                >
                </el-table-column>
                <el-table-column prop="goodPic" label="图片">
                  <template slot-scope="scope">
                    <el-image
                      v-if="scope.row.goodPic"
                      style="width: 100px; height: 100px"
                      :src="scope.row.goodPic"
                      :preview-src-list="[scope.row.goodPic]"
                    >
                    </el-image>
                  </template>
                </el-table-column>
                <el-table-column prop="goodBoxNum" label="箱规（数量）">
                </el-table-column>
                <el-table-column prop="goodBoxNum" label="箱规（尺寸mm）">
                </el-table-column>
                <el-table-column prop="goodBoxSize" label="单个产品包装尺寸mm">
                </el-table-column>
                <el-table-column prop="shopFans" label="店铺粉丝量">
                </el-table-column>
                <el-table-column prop="goodSaleNum" label="产品销量">
                </el-table-column>
                <!-- <el-table-column
                          prop="finalPrice"
                          width="180"
                          label="旗舰店实际成交价">
                      </el-table-column> -->
                <el-table-column
                  prop="realReadPrice"
                  width="180"
                  label="实际成交价"
                >
                </el-table-column>
                <el-table-column prop="totalPrice" fixed="right" label="货值合计">
                </el-table-column>
              </el-table>
            </div>
          </el-form-item>
          <el-form-item
            v-if="goodList && goodList.length > 0 && this.upform.fileType == 2"
          >
            <div class="form_table_goods">
              <el-table
                :data="goodList"
                :summary-method="getSummaries"
                show-summary
                max-height="750"
                :row-style="{ height: '0' }"
                :cell-style="{ padding: '3px' }"
                style="width: 100%"
              >
                <el-table-column prop="chainStoreName" fixed label="连锁店铺名称">
                </el-table-column>
                <el-table-column prop="category" fixed label="连锁店铺名称">
                </el-table-column>
                <el-table-column prop="storeNumber" label="店铺数量">
                </el-table-column>
                <el-table-column
                  prop="averageScore"
                  label="美团/大众点评店铺平均评分"
                >
                </el-table-column>
                <el-table-column prop="validityPeriod" label="有效期">
                </el-table-column>
                <el-table-column prop="distributedCities" label="分布城市">
                </el-table-column>
                <el-table-column prop="productName" label="产品名称">
                </el-table-column>
                <el-table-column prop="price" label="价值"> </el-table-column>
                <el-table-column prop="num" label="数量"> </el-table-column>
                <el-table-column prop="useRights" label="使用权益">
                </el-table-column>
                <el-table-column prop="couponForm" label="卡券形式">
                </el-table-column>
                <el-table-column prop="usageRestrictions" label="使用限制">
                </el-table-column>
                <el-table-column
                  prop="storeLinks"
                  show-overflow-tooltip
                  label="店铺链接（美团、携程等）"
                >
                </el-table-column>
                <el-table-column prop="verificationProcess" label="核销流程">
                </el-table-column>
                <el-table-column prop="finalPrice" label="实际成交价">
                </el-table-column>
                <el-table-column prop="totalPrice" fixed="right" label="合计">
                </el-table-column>
              </el-table>
            </div>
          </el-form-item>
          <el-form-item
            v-if="goodList && goodList.length > 0 && this.upform.fileType == 3"
          >
            <div class="form_table_goods">
              <el-table
                :data="goodList"
                :summary-method="getSummaries"
                show-summary
                max-height="750"
                :row-style="{ height: '0' }"
                :cell-style="{ padding: '3px' }"
                style="width: 100%"
              >
                <el-table-column prop="hotelName" fixed label="酒店名称">
                </el-table-column>
                <el-table-column prop="hotelAddress" fixed label="酒店地址">
                </el-table-column>
                <el-table-column prop="busyTime" label="旺季时间">
                </el-table-column>
                <el-table-column prop="hotelType" label="房型"> </el-table-column>
                <el-table-column prop="expirationDate" label="有效期">
                </el-table-column>
                <el-table-column
                  prop="isHaveMorning"
                  label="是否含早"
                ></el-table-column>
                <el-table-column prop="num" label="数量"></el-table-column>
                <el-table-column prop="price" label="平台价"> </el-table-column>
                <el-table-column prop="url" show-overflow-tooltip label="链接">
                </el-table-column>
                <el-table-column prop="hotelPic" label="房间图片">
                  <template slot-scope="scope">
                    <el-image
                      v-if="scope.row.hotelPic"
                      style="width: 100px; height: 100px"
                      :src="scope.row.hotelPic"
                      :preview-src-list="[scope.row.hotelPic]"
                    >
                    </el-image>
                  </template>
                </el-table-column>
                <el-table-column prop="createTime" label="创建时间">
                </el-table-column>
                <el-table-column prop="realPrice" width="180" label="实际成交价">
                </el-table-column>
                <el-table-column prop="totalPrice" fixed="right" label="房值合计">
                </el-table-column>
              </el-table>
            </div>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">暂不上传</el-button>
          <el-button type="primary" @click="handleSave">提 交</el-button>
        </span>
      </el-dialog>
  </div>
</template>

<script>
import { renderAsync } from "docx-preview";
import APIProject from "@/api/apiProject";
import APIMedium from "@/api/apiMedium";
import APIAdmin from "@/api/apiCompanyUser";
import APISysLabel from "@/api/apiSysLabel";
// import Calendar from "@/components/calendar/Calendar";
import ProjectPackage from "@/components/ProjectPackage";
import APIBusinessAccount from "@/api/apiBusinessAccount";
import APIProjectIntendedMedia from "@/api/apiProjectIntendedMedia";
import APIDetail from "@/api/apidetail";
import axios from "axios";
import qs from "qs";
import APIOrder from "@/api/apiOrder";
export function preview(params) {
  return renderAsync({
    url: `/preview`,
    method: "GET",
    params,
  });
}
export default {
  name: "Porject",
  components: {
    // Calendar,
    ProjectPackage,
  },
  props: {
    operationList: Array,
    isShow: Boolean,
    modelStatus: Number,
  },
  watch: {
    modelStatus(val) {
      if (val) {
      }
    },
    isShow(val) {
      if (val) {
        this.getPost();
      }
    },
    choosePackageDialog(val) {
      console.log("choosePackageDialog", val);
      if (!val) {
        this.cleanTableSelect();
      }
    },
  },
  data() {
    return {
      reportMediumCaseDiagramPic:
        "https://checkorder-view.mejour.cn/pic/reportMediumCaseDiagram.png",
      stepfirst: true,
      url:'',
      goodList: [],
      uprules: {
        // fileType: [
        //   { required: true, message: "请选择订单类型", trigger: "change" },
        // ],

        // fileMsg: [
        //     { required: true, message: "请上传文件", trigger: "change" },
        // ],
      },
      dialogVisible:false,
      // 表格相关
      tableLoading: true,
      dataList: [],
      pageSize: 20,
      pageNum: 1,
      total: 0,
      pageSizes: [15, 20, 50],
      tokenData: {
        token: "",
      },
      searchForm: {
        keyword: null,
        cateIds: null,
        areaId: null,
        businessId: null,
        executionProgressId: null,
        arrivalProgressId: null,
        arrivalWarehouseId: null,
        status: null,
        isTimeOut: null,
      },
      dialogFormVisible: false,
      upform:{
        fileType: 1,
        fileMsg: 1,
      },
      form: {
        projectId: null,
        // projectName: '',
        name: "",
        brands: "",
        brandsUsername: "",
        cateIdList: [],
        bussinessUsername: "",
        areaIds: [],
        // permissionUsername: '',
        brandPlacement: "",
        brandPlacementPic: "",
        brandPlacementType: [],
        stationType: [],
        mediumType: "",
        city: "",
        orderTime: "",
        remark: "",
      },
      addMediaRequirementsMsgForm: {
        projectId: null,
        brandPlacement: "",
        brandPlacementType: [],
        stationType: [],
        mediumType: "",
        city: "",
        orderTime: "",
        remark: "",
      },
      formLabelWidth: "120px",
      dialogTitle: "新增",
      rules: {
        //  projectName: { required: true, message: '请输入客户公司名称', trigger: 'blur' },
        areaIds: { required: true, message: "请选择区域", trigger: "change" },
        projectType:{ required: true, message: "请选择项目类型", trigger: "change" },
        name: { required: true, message: "请输入项目名称", trigger: "blur" },
        brands: {
          required: true,
          message: "请输入品牌名称",
          trigger: "change",
        },
        bussinessUsername: {
          required: true,
          message: "请选择商务",
          trigger: "change",
        },
        brandPlacementType: {
          required: true,
          message: "请选择投放品牌类型",
          trigger: "change",
        },
        stationType: {
          required: true,
          message: "请选择资源类型",
          trigger: "change",
        },
        mediumType: {
          required: true,
          message: "请输入媒体类型",
          trigger: "blur",
        },
        city: { required: true, message: "请输入城市", trigger: "blur" },
        orderTime: {
          required: true,
          message: "请输入预计上刊时间",
          trigger: "blur",
        },
        cateIdList: {
          required: true,
          message: "请选择品类",
          trigger: "change",
        },
        // permissionUsername: { required: true, message: '请选择执行负责人', trigger: 'change' },
        mediumIdList: {
          required: true,
          message: "请输入报备媒体",
          trigger: "change",
          type: "array",
        },
        brandPlacement: {
          required: true,
          message: "请输入投放品牌",
          trigger: "blur",
        },
        brandPlacementPic: {
          required: true,
          message: "请选择投放品牌图片",
          trigger: "change",
        },
      },
      areaList: [],
      cateList: [],
      btnStatus: null,
      bussinessUserList: [],
      permissionUserList: [],
      userInfo: {},
      contractDialogVisible: false,
      chooseProjectId: null,
      chooseProjectBrands: null,
      chooseProjectName: null,
      previewDialogVisible: false, //预览
      previewLoading: false,
      dialogPreview: false,
      searchLoading: false,
      executionProgressList: [],
      arrivalProgressList: [],
      arrivalWarehouseList: [],
      // 实际货值
      actualValueDialogVisible: false,
      actualValuePrice: null,
      // 执行进度
      executionProgressId: null,
      executionProgressDialogVisible: false,
      // 到货进度
      arrivalProgressId: null,
      arrivalProgressDialogVisible: false,
      // 到货仓库
      arrivalWarehouseId: null,
      arrivalWarehouseDialogVisible: false,
      // 打折
      discountDialogVisible: false,
      discountForm: {
        isDiscount: null,
        discountContent: null,
        discountPic: null,
      },
      discountRules: {
        isDiscount: {
          required: true,
          message: "请选择是否需要打折",
          trigger: "blur",
        },
      },
      statusList: [
        {
          label: "创建中",
          value: 1,
        },
        {
          label: "核价中-未分配给渠道",
          value: 2,
        },
        {
          label: "核价中-已分配未反馈",
          value: 6,
        },
        {
          label: "核价中-已反馈未确认",
          value: 7,
        },
        {
          label: "跟进中",
          value: 3,
        },
        {
          label: "已签单",
          value: 4,
        },
        {
          label: "执行完",
          value: 5,
        },

        {
          label: "已黄单",
          value: 9,
        },
      ],
      failDialogVisible: false,
      failReason: "",
      searchChooseProjectId: null,
      searchChooseProjectName: "",
      uploadLoading: false,
      activeIndex: "10",
      chooseRow: null,
      fileList: [],
      hasShowAdd: true,
      packageDialogVisible: false,
      packageDialogVisibleNum: 1,
      packageList: [],
      choosePackageDialog: false,
      onlineUserType: [],
      offlineTypeList: [],
      dataOfflineList: [],
      dataOnlineList: [],
      searchLineForm: {
        offlineKeyword: "",
        userType: null,
        keyword: "",
        offlineType: null,
      },
      totalOffline: 0,
      totalOnline: 0,
      pageNumOffline: 1,
      pageSizeOffline: 10,
      pageNumOnline: 1,
      pageSizeOnline: 10,
      chooseOnlineList: [],
      chooseOfflineList: [],
      chooseAddIndex: null,
      dateCalendarDialog: false,
      dataPackageOfflineList: [],
      calendarStartTime: new Date().getTime(),
      calendarEndTime: new Date().getTime(),
      calendarType: 1,
      calendarScrollLeftStatus: true,
      destroyCloseDateCalendarDialog: false,
      brandsList: [],
      sureLoading: false,
      sureClickLoading: false,
      mediumOfflineCascaderList: [],
      mediumOfflineCascaderProps: { multiple: true },
      intendedMediaDialogVisible: false,
      intendedMediaChooseList: [],
      intendedMediaChooseProjectId: null,
      intendedMediaChooseProjectName: "",
      intendedMediaChooseProjectPic: "",
      stationTypeList: [
        {
          label: "自营",
          value: "自营",
        },
        {
          label: "外采",
          value: "外采",
        },
      ],
      brandPlacementTypeList: [],
      projectTypeList: [
        {
          label: "本地生活",
          value: "本地生活",
        },
        {
          label: "快消",
          value: "快消",
        },
      ],
      stepac: 0,
      MediumCascadertype: false,
      mediarequirementtype: false,
    };
  },
  activated() {
    this.tokenData.token = this.$store.state.token;
    this.userInfo = JSON.parse(localStorage.getItem("mujinguserInfo"));
    if (this.$route && this.$route.query) {
      this.searchChooseProjectId = this.$route.query.projectId;
      this.searchChooseProjectName = this.$route.query.projectName;
    }
    this.getPost();
  },
  mounted() {
    this.tokenData.token = this.$store.state.token;
    this.$bus.$on("clearSearchParams", () => {
      this.searchForm = {
        keyword: null,
        cateIds: null,
        areaId: null,
        businessId: null,
        executionProgressId: null,
        arrivalProgressId: null,
        arrivalWarehouseId: null,
        status: null,
        isTimeOut: null,
      };
    });
    this.$bus.$on("setDefaultBtnStatus", (defVal) => {
      this.btnStatus = defVal;
    });
  },
  methods: {
    changeMediumCascader(val) {
      if (!val || val.length == 0) {
        this.mediumOfflineCascaderList.forEach((item) => {
          item.disabled = false;
        });
      } else {
        this.mediumOfflineCascaderList.forEach((item) => {
          item.disabled = false;
          if (val.some((subArray) => subArray.includes(-1))) {
            if (item.value != -1) {
              item.disabled = true;
            }
          } else {
            if (item.value == -1) {
              item.disabled = true;
            }
          }
        });
      }
    },
    changeBrandPlacementType(val) {
      this.form.brandPlacementType = val;
    },
    changeBrandPlacement(val) {
      // if(val){
      //     this.form.addMediaRequirementsMsgForm.brandPlacement = val
      // }
    },
    handleViewMediaRequirements(row) {
      // 查看报备媒体列表
      let obj = {
        projectId: row.id,
        projectName: row.name,
      };
      localStorage.setItem("viewProject", JSON.stringify(obj));
      // this.$router.push({
      //     path: '/projectMediaRequirements',
      // })
      const routeUrl = this.$router.resolve({
        path: "/projectMediaRequirements",
      });
      window.open(routeUrl.href, "_blank");
    },
    handleViewIntendedMedia(row) {
      // 查看报备媒体列表
      let obj = {
        projectId: row.id,
        projectName: row.name,
      };
      localStorage.setItem("viewProject", JSON.stringify(obj));
      // this.$router.push({
      //     path: '/IntendedMedia',
      // })
      const routeUrl = this.$router.resolve({
        path: "/IntendedMedia",
      });
      window.open(routeUrl.href, "_blank");
    },
    handleViewProjectFile(row) {
      // 查看文件列表
      let obj = {
        projectId: row.id,
        projectName: row.name,
      };
      localStorage.setItem("viewProject", JSON.stringify(obj));
      // this.$router.push({
      //     path: '/projectFile',
      // })
      const routeUrl = this.$router.resolve({
        path: "/projectFile",
      });
      window.open(routeUrl.href, "_blank");
    },
    doSubmitIntendedMedia() {
      if (
        !this.intendedMediaChooseList ||
        this.intendedMediaChooseList.length == 0
      ) {
        this.$message({
          message: "请选择报备媒体",
          type: "error",
        });
        return;
      }
      let mediumList = [];
      this.intendedMediaChooseList.forEach((item) => {
        mediumList.push(item[1]);
      });
      let params = {
        projectId: this.intendedMediaChooseProjectId,
        mediumIds: mediumList.join(","),
        projectName: this.intendedMediaChooseProjectName,
        pic: this.intendedMediaChooseProjectPic,
      };
      APIProjectIntendedMedia.doAddIntendedMedia(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.getPost();
          this.intendedMediaDialogVisible = false;
        }
      });
    },
    handleCloseIntendedMediaDialog() {
      this.intendedMediaDialogVisible = false;
    },
    handleAddIntendedMedia(row) {
      this.intendedMediaChooseProjectId = row.id;
      this.intendedMediaChooseProjectName = row.name;
      this.intendedMediaChooseProjectPic = row.brandPlacementPic;
      this.intendedMediaChooseList = [];
      this.getMediumOfflineCascaderList();
      this.intendedMediaDialogVisible = true;
    },
    getMediumOfflineCascaderList() {
      const params = {
        token: this.$store.state.token,
      };
      APIMedium.getMediumOfflineCascader(params).then((res) => {
        if (res.key === 1000) {
          var list = res.result.list;
          list.forEach((item) => {
            item.disabled = false;
          });
          let noObj = [
            {
              label: "无需报备",
              value: -1,
              disabled: false,
              children: [
                {
                  label: "无需报备",
                  value: -1,
                },
              ],
            },
          ];
          this.mediumOfflineCascaderList = [...noObj, ...list];
        }
      });
    },
    doGetHasAddProjectName() {
      if (!this.name) {
        return;
      }
      this.sureClickLoading = true;
      document.querySelector("#asNameInp").style.borderColor = "";
      const params = {
        token: this.$store.state.token,
        name: this.form.name,
      };
      APIProject.doGetHasAddProjectName(params).then((res) => {
        if (res.key === 1000) {
          let data = res.result.data;
          if (data && data == 2) {
            this.sureLoading = true;
            document.querySelector("#asNameInp").style.borderColor = "red";
          } else {
            this.sureLoading = false;
          }
          this.sureClickLoading = false;
        }
      });
    },
    changeBusiness(val) {
      if (val) {
        this.bussinessUserList.forEach((item) => {
          if (item.sysValueName == val) {
            this.getBusinessAccountList(item.id);
          }
        });
      }
    },
    changeBrands(val) {
      if (val) {
        this.brandsList.forEach((item) => {
          if (item.brandsName == val) {
            this.form.projectName = item.companyName;
            this.form.brandsUsername = item.contactPersonName;
            this.form.brandPlacement = item.brandsName;
            // this.form.addMediaRequirementsMsgForm.brandPlacement = item.brandsName
          }
        });
      }
    },
    getBusinessAccountList(businessId) {
      this.$bus.$emit("show-loading", true);
      const params = {
        token: this.$store.state.token,
      };
      if (
        this.userInfo &&
        this.userInfo.role &&
        (this.userInfo.role.includes(40) || this.userInfo.role.includes(55))
      ) {
        params.businessId = this.userInfo.userId;
      }
      if (businessId) {
        params.businessId = businessId;
      }
      APIBusinessAccount.getBusinessAccountList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result.list;
          this.brandsList = res;
        }
        this.$bus.$emit("show-loading", false);
      });
    },
    closeDateCalendarDialog() {
      console.log("关闭");
      this.calendarStartTime = new Date().getTime();
      this.calendarEndTime = this.calendarStartTime;
      this.dataPackageOfflineList = [];
      this.calendarScrollLeftStatus = true;
      this.calendarType = 1;
    },
    scrollStartCalendar(val) {
      // 日历滑到最左边了
      console.log("左边", val);
      this.getLastMonthStart(new Date(val.dateTime));
      this.getLastMonthEnd(new Date(val.dateTime));
      this.$nextTick(() => {
        this.showPackage(2);
      });
    },
    getLastMonthStart(currentDate) {
      // 获取上个月的第一天
      // 将月份减1
      currentDate.setMonth(currentDate.getMonth() - 1);
      // 将日期设置为1
      currentDate.setDate(1);
      // 获取上个月的第一天
      let firstDayOfLastMonth = new Date(currentDate.getTime());
      this.calendarStartTime = firstDayOfLastMonth.getTime();
    },
    getLastMonthEnd(currentDate) {
      // 获取上个月的最后一天
      // 将月份减1
      currentDate.setMonth(currentDate.getMonth() + 1);
      currentDate.setDate(0);
      currentDate.setHours(23, 59, 59, 999);
      let firstDayOfLastMonth = new Date(currentDate.getTime());
      this.calendarEndTime = firstDayOfLastMonth.getTime();
    },
    scrollEndCalendar(val) {
      // 日历滑到最右边了
      console.log("右边", val);
      this.getNextMonthStart(new Date(val.dateTime));
      this.getNextMonthEnd(new Date(val.dateTime));
      this.$nextTick(() => {
        this.showPackage(2);
      });
    },
    getNextMonthStart(currentDate) {
      // 获取下个月的第一天
      // 将月份加1
      currentDate.setMonth(currentDate.getMonth() + 2);
      // 将日期设置为1
      currentDate.setDate(0);
      currentDate.setHours(0, 0, 0, 0);
      // 获取下个月的第一天
      let firstDayOfNextMonth = new Date(currentDate.getTime());
      firstDayOfNextMonth.setDate(1);
      this.calendarStartTime = firstDayOfNextMonth.getTime();
    },
    getNextMonthEnd(currentDate) {
      // 获取下个月的最后一天
      let lastDayOfNextMonth = new Date(
        currentDate.getFullYear(),
        currentDate.getMonth() + 2,
        0,
        23,
        59,
        59,
        999
      );
      this.calendarEndTime = lastDayOfNextMonth.getTime();
    },
    exportPackage(row) {
      // this.tableLoading = true;
      const params = {
        token: this.$store.state.token,
        projectId: this.chooseProjectId,
        indexNum: row.addIndex,
      };
      APIProject.doExportPackage(params).then((res) => {
        if (res) {
          const content = res.data;
          const blob = new Blob([content]);
          // 从response的headers中获取filename,
          // 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
          var contentDisposition = res.headers["content-disposition"];
          var patt = new RegExp("filename=([^;]+\\.[^\\.;]+);*");
          var result = patt.exec(contentDisposition);
          const fileName = decodeURI(result[1]);
          if ("download" in document.createElement("a")) {
            // 非IE下载
            const elink = document.createElement("a");
            elink.download = fileName;
            elink.style.display = "none";
            elink.href = URL.createObjectURL(blob);
            document.body.appendChild(elink);
            elink.click();
            URL.revokeObjectURL(elink.href); // 释放URL 对象
            document.body.removeChild(elink);
          } else {
            // IE10+下载
            navigator.msSaveBlob(blob, fileName);
          }
        }
      });
    },
    cleanTableSelect() {
      let that = this;
      setTimeout(() => {
        that.$refs.onlineTable.clearSelection();
        that.$refs.offlineTable.clearSelection();
      }, 500);
    },
    get_row_key(row) {
      return row.id;
    },
    doSurePackageDialogVisible() {
      let list = [];
      let needAddOnlineNum = false;
      let needAddOfflineNum = false;
      if (this.chooseOnlineList && this.chooseOnlineList.length > 0) {
        this.chooseOnlineList.forEach((item) => {
          if (!item.chooseNum) {
            needAddOnlineNum = true;
          }
          let dto = {
            mediumId: item.id,
            mediumType: 1,
            num: item.chooseNum,
          };
          this.dataOnlineList.forEach((item2) => {
            if (item2.id == item.id) {
              dto.num = item2.chooseNum;
            }
          });
          list.push(dto);
        });
      }
      if (this.chooseOfflineList && this.chooseOfflineList.length > 0) {
        this.chooseOfflineList.forEach((item) => {
          if (!item.chooseNum) {
            needAddOfflineNum = true;
          }
          let dto = {
            mediumId: item.id,
            mediumType: 2,
            num: item.chooseNum,
          };
          this.dataOfflineList.forEach((item2) => {
            if (item2.id == item.id) {
              dto.num = item2.chooseNum;
            }
          });
          list.push(dto);
        });
      }
      if (needAddOnlineNum) {
        this.$message({
          message: "请输入线上媒体的数量",
          type: "error",
        });
        return;
      }
      if (needAddOfflineNum) {
        this.$message({
          message: "请输入线下媒体的数量",
          type: "error",
        });
        return;
      }
      if (!list || list.length == 0) {
        this.$message({
          message: "请选择媒体",
          type: "error",
        });
        return;
      }

      let params = {
        projectId: this.chooseProjectId,
        mediums: JSON.stringify(list),
      };
      if (this.chooseAddIndex) {
        params.chooseAddIndex = this.chooseAddIndex;
      }
      APIProject.doPackageManageProject(params).then((res) => {
        if (res.key === 1000) {
          this.handlePackage(
            this.chooseProjectId,
            this.chooseProjectBrands,
            this.chooseProjectName
          );
          this.choosePackageDialog = false;
        }
      });
    },
    handleSelectionChangePackageOnlineList(val) {
      this.chooseOnlineList = val;
    },
    handleSelectionChangePackageOfflineList(val) {
      this.chooseOfflineList = val;
    },
    showPackage(type) {
      this.calendarScrollLeftStatus = false;
      if (type == 1) {
        this.getLastMonthStart(new Date());
        this.getNextMonthEnd(new Date());
        this.dataPackageOfflineList = [];
        this.calendarType = this.calendarType + 1;
      }
      let that = this;
      let params = {
        startTime: this.calendarStartTime,
        endTime: this.calendarEndTime,
      };
      APIProject.viewOfflineHasPackageProjectList(params).then((res) => {
        if (res.key === 1000) {
          let result = res.result;
          let list = result.list;
          let showOfflineList = [
            {
              name: "",
            },
          ];
          let qList = [];
          list.forEach((item) => {
            for (var i = 0; i < item.num; i++) {
              let dtoList =
                item.projectMsgDTOList &&
                item.projectMsgDTOList.length > 0 &&
                i < item.projectMsgDTOList.length
                  ? [item.projectMsgDTOList[i]]
                  : [];
              item.projectList = dtoList;
              qList.push(JSON.parse(JSON.stringify(item)));
            }
          });
          qList.forEach((item) => {
            item.projectMsgDTOList = item.projectList;
          });
          let offlineList = [];
          qList.forEach((item) => {
            let projectMap = {};
            let dto = item;
            dto.chooseNum = item.num;
            if (item.projectMsgDTOList && item.projectMsgDTOList.length > 0) {
              item.projectChooseList = item.projectMsgDTOList;
              item.projectMsgDTOList.forEach((projectItem) => {
                if (projectItem && projectItem.chooseTime) {
                  projectItem.date = this.$moment(
                    projectItem.chooseTime
                  ).format("YYYY-MM-DD");
                  let a = projectMap[projectItem.date];
                  if (a) {
                    a.push(projectItem.projectName);
                  } else {
                    projectMap[projectItem.date] = [projectItem.projectName];
                  }
                }
              });
            }
            dto.projectMap = projectMap;
            offlineList.push(dto);
          });
          let dtoList = [];
          // 判断是第一次的列表数据还是新增上去的列表数据
          if (
            that.dataPackageOfflineList &&
            that.dataPackageOfflineList.length > 0
          ) {
            let aList = JSON.parse(JSON.stringify(that.dataPackageOfflineList));
            aList.shift(); // 去掉第一个元素
            let bList = aList;
            bList.forEach((item, index) => {
              offlineList.forEach((item2, index2) => {
                if (item.id == item2.id) {
                  item2.projectMap = {
                    ...item.projectMap,
                    ...item2.projectMap,
                  };
                  // item2.projectMsgDTOList = item2.projectMsgDTOList.concat(item.projectMsgDTOList);
                }
              });
            });
            dtoList = offlineList;
          } else {
            dtoList = offlineList;
          }
          let showList = showOfflineList.concat(dtoList);
          that.dataPackageOfflineList = JSON.parse(JSON.stringify(showList));
          this.calendarType = this.calendarType + 1;
          if (type == 1) {
            that.dateCalendarDialog = true;
          }
        }
      });
    },
    updatePackage(row) {
      let that = this;
      this.chooseAddIndex = row.addIndex;
      this.searchLineForm = {
        offlineKeyword: "",
        userType: null,
        keyword: "",
        offlineType: null,
      };
      this.getSysLabel20();
      this.getSysLabel21();
      this.pageNumOnline = 1;
      this.pageSizeOnline = 10;
      this.getOnlinePost();
      this.pageNumOffline = 1;
      this.pageSizeOffline = 10;
      this.getOfflinePost();

      let params = {
        projectId: this.chooseProjectId,
        indexNum: row.addIndex,
      };
      APIProject.viewPackageManageProjectMsg(params).then((res) => {
        if (res.key === 1000) {
          let result = res.result;
          let list = result.list;
          let onlineList = [];
          let offlineList = [];
          list.forEach((item) => {
            if (item.lineType == 1) {
              let dto = item.mediumOnline;
              that.dataOnlineList.forEach((onlineItem) => {
                if (onlineItem.id == dto.id) {
                  onlineItem.chooseNum = item.num;
                  onlineList.push(onlineItem);
                }
              });
            } else {
              let dto = item.mediumOffline;
              that.dataOfflineList.forEach((offlineItem) => {
                if (offlineItem.id == dto.id) {
                  offlineItem.chooseNum = item.num;
                  offlineList.push(offlineItem);
                }
              });
            }
          });
          onlineList.forEach((item) => {
            that.chooseOnlineList.push(item);
            that.dataOnlineList.forEach((onlineItem) => {
              if (onlineItem.id == item.id) {
                console.log("onlineItem", item);
                onlineItem.chooseNum = item.chooseNum;
              }
            });
          });
          offlineList.forEach((item) => {
            that.chooseOfflineList.push(item);
            that.dataOfflineList.forEach((offlineItem) => {
              if (offlineItem.id == item.id) {
                offlineItem.chooseNum = item.chooseNum;
              }
            });
          });
          that.choosePackageDialog = true;
          that.$nextTick(() => {
            onlineList.forEach((item) => {
              that.$refs.onlineTable.toggleRowSelection(item, true);
            });
            offlineList.forEach((item) => {
              that.$refs.offlineTable.toggleRowSelection(item, true);
            });
            that.dataOnlineList = JSON.parse(
              JSON.stringify(that.dataOnlineList)
            );
            that.dataOfflineList = JSON.parse(
              JSON.stringify(that.dataOfflineList)
            );
          });
        }
      });
    },
    goPackageDialog() {
      let that = this;
      this.searchLineForm = {
        offlineKeyword: "",
        userType: null,
        keyword: "",
        offlineType: null,
      };
      this.getSysLabel20();
      this.getSysLabel21();
      this.pageNumOnline = 1;
      this.pageSizeOnline = 10;
      this.getOnlinePost();
      this.pageNumOffline = 1;
      this.pageSizeOffline = 10;
      this.getOfflinePost();
      this.choosePackageDialog = true;
    },
    handleSelectionChangePackage(val) {
      console.log(val);
    },
    handleClosePackageDialog() {
      this.packageDialogVisibleNum = 1;
      this.packageDialogVisible = false;
    },
    handlePackage(id, brands, name) {
      this.packageDialogVisible = true;
      this.$nextTick(() => {
        this.chooseProjectId = id;
        this.chooseProjectBrands = brands;
        this.chooseProjectName = name;
        this.chooseAddIndex = null;
        this.packageDialogVisibleNum = this.packageDialogVisibleNum + 1;
      });
      // let params = {
      //     projectId: this.chooseProjectId,
      // }
      // APIProject.viewPackageManageProjectList(params).then((res) => {
      //     if (res.key === 1000) {
      //         let result = res.result
      //         this.packageList = result.list
      //         this.packageDialogVisible = true;
      //     }
      // });
    },
    handleSelectMenu(key, keyPath) {
      console.log(key, keyPath);
      if (key) {
        if (key == 10) {
          this.searchForm.status = null;
        } else {
          this.searchForm.status = parseInt(key);
        }
        this.rePosts();
      }
    },
    uploadFileLoading(e) {
      this.uploadLoading = true;
    },
    goCleanSearchProject() {
      this.searchChooseProjectId = null;
      this.searchChooseProjectName = "";
      this.getPost();
    },
    submitFail() {
      let params = {
        projectId: this.chooseProjectId,
        failReason: this.failReason,
      };
      APIProject.doFailManageProject(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chooseProjectId = null;
          this.getPost();
          this.failDialogVisible = false;
          this.failReason = "";
        }
      });
    },
    changeKeyword(val) {
      console.log(val);
      this.getPost();
    },
    submitUpdateDiscount() {
      let params = {
        id: this.chooseProjectId,
        isDiscount: this.discountForm.isDiscount,
      };
      if (this.discountForm.isDiscount && this.discountForm.isDiscount == 1) {
        if (this.discountForm.discountContent) {
          params.discountContent = this.discountForm.discountContent;
        }
        if (this.discountForm.discountPic) {
          params.discountPic = this.discountForm.discountPic;
        }
      }
      APIProject.editManageDiscount(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chooseProjectId = null;
          this.getPost();
          this.discountDialogVisible = false;
        }
      });
    },
    handlePreview(file) {
      console.log(file);
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handleAvatarSuccess: function (e) {
      if (e.key == 1000) {
        this.discountForm.discountPic = e.result.data;
        this.$message.success({
          showClose: true,
          message: "上传成功",
          duration: 1500,
        });
      }
    },
    submitArrivalWarehouse() {
      let params = {
        id: this.chooseProjectId,
        arrivalWarehouseId: this.arrivalWarehouseId,
      };
      APIProject.editManageArrivalProgress(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chooseProjectId = null;
          this.getPost();
          this.arrivalWarehouseDialogVisible = false;
        }
      });
    },
    submitArrivalProgress() {
      let params = {
        id: this.chooseProjectId,
        arrivalProgressId: this.arrivalProgressId,
      };
      APIProject.editManageArrivalProgress(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chooseProjectId = null;
          this.getPost();
          this.arrivalProgressDialogVisible = false;
        }
      });
    },
    submitExecutionProgress() {
      let params = {
        id: this.chooseProjectId,
        executionProgressId: this.executionProgressId,
      };
      APIProject.editManageArrivalProgress(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chooseProjectId = null;
          this.getPost();
          this.executionProgressDialogVisible = false;
        }
      });
    },
    submitActualValuePrice() {
      let params = {
        id: this.chooseProjectId,
        actualValuePrice: this.actualValuePrice,
      };
      APIProject.editManageActualValuePrice(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.getPost();
          this.actualValueDialogVisible = false;
        }
      });
    },
    getSysLabelListById(val) {
      const params = {
        token: this.$store.state.token,
        sysLabelIds: val,
      };
      APISysLabel.getSysLabelValueManageList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result;
          if (res.data) {
            this.cateList = res.data[2];
            this.areaList = res.data[3];
            if (
              this.userInfo &&
              this.userInfo.role &&
              (this.userInfo.role.includes(40) ||
                this.userInfo.role.includes(55))
            ) {
              this.form.areaIds = this.userInfo.area;
            }
            this.bussinessUserList = res.data[7];
            if (
              this.userInfo &&
              this.userInfo.role &&
              (this.userInfo.role.includes(40) ||
                this.userInfo.role.includes(55))
            ) {
              this.form.bussinessUsername = this.userInfo.username;
            }
            this.executionProgressList = res.data[12];
            this.arrivalProgressList = res.data[13];
            this.arrivalWarehouseList = res.data[14];
            this.searchLoading = false;
          }
        }
      });
    },
    visibleChangeBussiness(val) {
      if (val) {
        if (!this.bussinessUserList || this.bussinessUserList.length == 0) {
          this.searchLoading = true;
          this.getSysLabelListById(7);
        }
      }
    },
    visibleChangeArea(val) {
      if (val) {
        if (!this.areaList || this.areaList.length == 0) {
          this.searchLoading = true;
          this.getSysLabelListById(3);
        }
      }
    },
    visibleChangeCateIds(val) {
      if (val) {
        if (!this.cateList || this.cateList.length == 0) {
          this.searchLoading = true;
          this.getSysLabelListById(2);
        }
      }
    },
    visibleChangeArrivalWarehouse(val) {
      if (val) {
        if (
          !this.arrivalWarehouseList ||
          this.arrivalWarehouseList.length == 0
        ) {
          this.searchLoading = true;
          this.getSysLabelListById(14);
        }
      }
    },
    visibleChangeArrivalProgress(val) {
      if (val) {
        if (!this.arrivalProgressList || this.arrivalProgressList.length == 0) {
          this.searchLoading = true;
          this.getSysLabelListById(13);
        }
      }
    },
    visibleChangeExecutionProgress(val) {
      if (val) {
        if (
          !this.executionProgressList ||
          this.executionProgressList.length == 0
        ) {
          this.searchLoading = true;
          this.getSysLabelListById(12);
        }
      }
    },
    // 预览
    previewClick(row) {
      const params = {
        reportId: row.contractUrl,
      };
      preview(params)
        .then((res) => {
          console.log("res111", res);
          // res.data 为接口返回的html完整文件代码
          // 必须要存进localstorage，否则会报错，显示不完全
          window.localStorage.removeItem("callbackHTML");
          window.localStorage.setItem("callbackHTML", res.data);
          // // 读取本地保存的html数据，使用新窗口打开
          const newWin = window.open("", "_blank");
          newWin.document.write(localStorage.getItem("callbackHTML"));
          // // 关闭输出流
          newWin.document.close();
        })
        .catch((err) => {
          console.log("err23232323", err);
        });
    },
    showContract(row) {
      this.contractDialogVisible = true;
      this.fileList = row.contractUrl.split(",");
      this.chooseRow = row;
      this.hasShowAdd = false;
    },
    delContract(index) {
      this.fileList.splice(index, 1);
      this.updateContractUrl(this.fileList.join(","));
    },
    handleViewContract(index) {
      if (this.fileList && this.fileList.length > 0) {
        window.open(this.fileList[index], "_blank");
      }
    },
    handleAvatarSuccessUpdateBrandPlacementPic: function (e) {
      if (e.key == 1000) {
        this.intendedMediaChooseProjectPic = e.result.data;
        this.$message.success({
          showClose: true,
          message: "上传成功",
          duration: 1500,
        });
      }
    },
    handleAvatarSuccessBrandPlacementPic: function (e) {
      if (e.key == 1000) {
        this.form.brandPlacementPic = e.result.data;
        this.$message.success({
          showClose: true,
          message: "上传成功",
          duration: 1500,
        });
      }
    },
    handleAvatarSuccessFile(e) {
      let file = e.result.data;
      let files = this.chooseRow.contractUrl
        ? this.chooseRow.contractUrl + "," + file
        : file;
      this.fileList = files.split(",");
      this.updateContractUrl(files);
    },
    updateContractUrl(files) {
      this.uploadLoading = true;
      const params = {
        token: this.$store.state.token,
        contractUrl: files,
        id: this.chooseProjectId,
      };
      APIProject.editManageProjectContract(params).then((res) => {
        if (res.key === 1000) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.uploadLoading = false;
          this.getPost();
          this.chooseRow.contractUrl = files;
          // this.contractDialogVisible = false
        }
      });
    },
    handleClickSureCheck(row) {
      const params = {
        token: this.$store.state.token,
        projectId: row.id,
      };
      APIProject.doSureCheckProject(params).then((res) => {
        if (res.key === 1000) {
          this.getPost();
        }
      });
    },
    handleCommand(e, row) {
      this.chooseProjectId = row.id;
      if (e == "edit") {
        // this.handleClick(row)
        localStorage.setItem("editProject", JSON.stringify(row));
        this.$router.push({
          path: "/EditProject",
        });
      } else if (e == "sureCheckProject") {
        this.$confirm("此操作将确认签单该项目, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.handleClickSureCheck(row);
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      } else if (e == "del") {
        this.$confirm("此操作将永久删除该项目, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.handleClickDel(row);
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      } else if (e == "editContract") {
        this.contractDialogVisible = true;
        if (row.contractUrl) {
          this.fileList = row.contractUrl.split(",");
        } else {
          this.fileList = [];
        }
        this.chooseRow = row;
        this.hasShowAdd = true;
      } else if (e == "editExecutionProgress") {
        this.visibleChangeExecutionProgress(true);
        this.executionProgressId = row.executionProgressId
          ? parseInt(row.executionProgressId)
          : null;
        this.executionProgressDialogVisible = true;
      } else if (e == "editArrivalProgress") {
        this.visibleChangeArrivalProgress(true);
        this.arrivalProgressId = row.arrivalProgressId
          ? parseInt(row.arrivalProgressId)
          : null;
        this.arrivalProgressDialogVisible = true;
      } else if (e == "editArrivalWarehouse") {
        this.visibleChangeArrivalWarehouse(true);
        this.arrivalWarehouseId = row.arrivalWarehouseId
          ? parseInt(row.arrivalWarehouseId)
          : null;
        this.arrivalWarehouseDialogVisible = true;
      } else if (e == "editDiscount") {
        this.discountForm = {
          isDiscount: row.isDiscount,
          discountContent: row.discountContent,
          discountPic: row.discountPic,
        };
        this.discountDialogVisible = true;
      } else if (e == "fail") {
        this.failReason = "";
        this.failDialogVisible = true;
      } else if (e == "package") {
        this.handlePackage(row.id, row.brands, row.projectName);
      } else if (e == "handleAddOrder") {
        this.handleAddOrder(row);
      } else if (e == "handleViewOrder") {
        this.handleViewOrder(row);
      } else if (e == "showContract") {
        this.showContract(row);
      } else if (e == "handleAddIntendedMedia") {
        this.handleAddIntendedMedia(row);
      } else if (e == "handleViewIntendedMedia") {
        this.handleViewIntendedMedia(row);
      } else if (e == "handleViewMediaRequirements") {
        this.handleViewMediaRequirements(row);
      } else if (e == "handleViewProjectFile") {
        this.handleViewProjectFile(row);
      }
    },
    getPermissionUserList() {
      const params = {
        token: this.$store.state.token,
        roleId: "50,51,61",
      };
      APIAdmin.adminUserList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result;
          this.permissionUserList = res.list;
        }
      });
    },
    changeArea(val) {
      if (val) {
        let areaName = "";
        this.areaList.forEach((item) => {
          if (item.id == val) {
            areaName = item.sysValueName;
          }
        });
        if (areaName) {
          this.getSysLabelListByAreaKeyword(areaName);
        }
      }
    },
    getSysLabelListByAreaKeyword(keyword) {
      const params = {
        token: this.$store.state.token,
        sysLabelIds: "7",
        keyword: keyword,
      };
      APISysLabel.getSysLabelValueManageList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result;
          if (res.data) {
            this.bussinessUserList = res.data[7];
            if (
              this.userInfo &&
              this.userInfo.role &&
              (this.userInfo.role.includes(40) ||
                this.userInfo.role.includes(55))
            ) {
              this.form.bussinessUsername = this.userInfo.username;
            }
          }
        }
      });
    },
    handleAddOrder(row) {
      this.$router.push({
        path: "/EditOrder",
        query: {
          projectId: row.id,
          departId: row.departId,
          projectName: row.name,
        },
      });
    },
    handleViewOrder(row) {
      this.$router.push({
        path: "/order",
        query: {
          projectId: row.id,
        },
      });
    },
    handleClickDel(row) {
      const params = {
        token: this.$store.state.token,
        projectId: row.id,
      };
      APIProject.delManageProject(params).then((res) => {
        if (res.key === 1000) {
          this.getPost();
        }
      });
    },
    getSysLabelList() {
      const params = {
        token: this.$store.state.token,
        sysLabelIds: "2,3,7,59",
      };
      APISysLabel.getSysLabelValueManageList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result;
          if (res.data) {
            this.cateList = res.data[2];
            this.brandPlacementTypeList = res.data[2];
            this.areaList = res.data[3];
            if (
              this.userInfo &&
              this.userInfo.role &&
              (this.userInfo.role.includes(40) ||
                this.userInfo.role.includes(55))
            ) {
              this.form.areaIds = this.userInfo.area;
            }
            this.bussinessUserList = res.data[7];
            if (
              this.userInfo &&
              this.userInfo.role &&
              (this.userInfo.role.includes(40) ||
                this.userInfo.role.includes(55))
            ) {
              this.form.bussinessUsername = this.userInfo.username;
            }
          }
        }
      });
    },
    backShow() {
      this.$emit("backShow");
    },
    handleClick(item) {
      if (
        !this.cateList ||
        this.cateList.length == 0 ||
        !this.areaList ||
        this.areaList.length == 0 ||
        !this.bussinessUserList ||
        this.bussinessUserList.length == 0
      ) {
        this.getSysLabelList();
      }
      let a = JSON.parse(JSON.stringify(item));
      this.dialogTitle = "编辑";
      this.getPermissionUserList();
      this.form = a;
      this.form.areaIds = parseInt(a.areaId);
      this.form.projectId = a.id;
      this.getBusinessAccountList();
      setTimeout(() => {
        this.dialogFormVisible = true;
      }, 200);
    },
    submitForm() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          const params = this.form;
          this.sureClickLoading = true;
          if (params.cateIdList && params.cateIdList.length > 0) {
            params.cateIds = params.cateIdList.join(",");
          }
          if (params.areaIds && typeof params.areaIds === "number") {
            params.areaId = params.areaIds + "";
          } else {
            if (params.areaIds && params.areaIds.length > 0) {
              params.areaId = params.areaIds.join(",");
            }
          }
          if (params.bussinessUsername) {
            this.bussinessUserList.forEach((item) => {
              if (item.sysValueName == params.bussinessUsername) {
                params.businessId = item.id;
              }
            });
          }
          // if(params.permissionUsername){
          //     this.permissionUserList.forEach(item => {
          //         if(item.username == params.permissionUsername){
          //             params.permissionId = item.id
          //         }
          //     })
          // }
          if (params.brands) {
            this.brandsList.forEach((item) => {
              if (item.brandsName == params.brands) {
                params.brandId = item.id;
              }
            });
          }

          params.token = this.$store.state.token;
          // if (this.form.projectId) {
          //     params.projectId = this.form.projectId
          //     APIProject.editManageProject(params).then((res) => {
          //         if (res.key === 1000) {
          //             this.$message({
          //                 message: '修改成功',
          //                 type: 'success'
          //             });
          //             this.getPost()
          //             this.dialogFormVisible = false
          //         }
          //     });
          // } else {
          if (this.form.mediumIdList && this.form.mediumIdList.length > 0) {
            let mediumList = [];
            this.form.mediumIdList.forEach((item) => {
              mediumList.push(item[1]);
            });
            params.mediumIds = mediumList.join(",");
          }
          // if (this.form && this.form.brandPlacementType){
          //     var mediaRequirementsCreateReq = {
          //         projectId: this.form.projectId,
          //         brandPlacement: this.form.brandPlacement,
          //         brandPlacementType: this.form.brandPlacementType.join(","),
          //         stationTypes: this.form.stationTypes,
          //         mediumType: this.form.mediumType,
          //         city: this.form.city,
          //         orderTime: this.form.orderTime,
          //         remark: this.form.remark,
          //     }
          //     if (mediaRequirementsCreateReq.stationTypes && mediaRequirementsCreateReq.stationTypes.length > 0) {
          //         mediaRequirementsCreateReq.stationType = mediaRequirementsCreateReq.stationTypes.join(",")
          //     }
          //     params.mediaRequirementsCreateReq = mediaRequirementsCreateReq
          // }

          // APIProject.addManageProject(params).then((res) => {
          //     if (res.key === 1000) {
          //         this.$message({
          //             message: '添加成功',
          //             type: 'success'
          //         });
          //         this.getPost()
          //         this.dialogFormVisible = false
          //     }
          // });
          console.log(this.chooseProjectId)
          if (!this.stepfirst && !this.MediumCascadertype) {
            const formData = { ...this.form };
            formData.stationType = formData.stationType.join(",");
            formData.brandPlacementType = formData.brandPlacementType.join(",");
            formData.cateIdList = formData.cateIdList.join(",");
            formData.mediumIdList = formData.mediumIdList.join(",");
            let params = {
              projectId: this.chooseProjectId,
              projectMediaRequirements: [formData],
            };
          
            APIDetail.addMediaRequirementsOnly(params)
              .then((res) => {
                if (res.key === 1000) {
                  this.$message({
                    message: "成功",
                    type: "success",
                  });
                  // this.getPost()
                  //this.mediarequirementtype = true;
                  if (this.stepac++ > 2) this.stepac = 0;
                  this.dialogFormVisible = false;
                  this.dialogVisible = true;
                //   this.$router.push({
                //     name: "ProjectDetail",
                //     params: { projectId: this.chooseProjectId },
                //   });
                  console.log("第三步的确认");
                }
              })
              .finally(() => {
                this.sureClickLoading = false;
              });
          } else if (this.MediumCascadertype) {
            params.projectId = this.chooseProjectId;
            APIDetail.doAddIntendedMedia(params)
              .then((res) => {
                if (res.key === 1000) {
                  this.$message({
                    message: "成功",
                    type: "success",
                  });
                  // this.getPost()
                  this.mediarequirementtype = true;
                  this.MediumCascadertype = false;
                  this.stepfirst = false;
                  if (this.stepac++ > 2) this.stepac = 0;

                  // this.dialogFormVisible = false
                  console.log("第二步的确认");
                }
              })
              .finally(() => {
                // 无论成功/失败，都结束加载
                this.sureClickLoading = false;
              });
          } else {
            APIDetail.addProjectOnly(params)
              .then((res) => {
                if (res.key === 1000) {
                  this.$message({
                    message: "添加成功",
                    type: "success",
                  });
                  this.getMediumOfflineCascaderList();
                  this.getPost();
                  this.chooseProjectId = res.result.data;
                  this.MediumCascadertype = true;
                  this.stepfirst = false;
                  if (this.stepac++ > 2) this.stepac = 0;

                  //this.dialogFormVisible = false
                  console.log("第一步的确认");
                }
              })
              .finally(() => {
                // 无论成功/失败，都结束加载
                this.sureClickLoading = false;
              });
          }

          //  }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    add() {
      if (
        !this.cateList ||
        this.cateList.length == 0 ||
        !this.areaList ||
        this.areaList.length == 0 ||
        !this.bussinessUserList ||
        this.bussinessUserList.length == 0 ||
        !this.brandPlacementTypeList ||
        this.brandPlacementTypeList.length == 0
      ) {
        this.getSysLabelList();
      }
      this.form = {
        projectId: null,
        projectName: "",
        name: "",
        brands: "",
        brandsUsername: "",
        cateIdList: [],
        bussinessUsername: "",
        areaIds: [],
        // permissionUsername: '',
        brandPlacement: "",
        brandPlacementPic: "",
        mediumIdList: [],
        brandPlacementType: [],
        stationType: [],
        mediumType: "",
        city: "",
        orderTime: "",
        remark: "",
        projectType: "",
      };
      if (
        this.userInfo &&
        this.userInfo.role &&
        (this.userInfo.role.includes(40) || this.userInfo.role.includes(55))
      ) {
        this.form.areaIds = this.userInfo.area;
      }
      if (
        this.userInfo &&
        this.userInfo.role &&
        (this.userInfo.role.includes(40) || this.userInfo.role.includes(55))
      ) {
        this.form.bussinessUsername = this.userInfo.username;
      }
      this.getPermissionUserList();
      this.getBusinessAccountList();
      // if (this.userInfo && this.userInfo.role && this.userInfo.role.includes(50)){
      //     this.form.permissionUsername = this.userInfo.username
      // }
      this.stepfirst = true;
      this.mediarequirementtype = false;
      this.MediumCascadertype = false;
      //this.getMediumOfflineCascaderList()
      setTimeout(() => {
        this.dialogFormVisible = true;
      }, 200);
    },
    formatterTime(time) {
      return this.$moment(time).format("YYYY-MM-DD HH:mm:ss");
    },
    // 全局初始化
    init() {
      // 搜索条件重置
      this.searchForm = {
        keyword: null,
        cateIds: null,
        areaId: null,
        businessId: null,
        executionProgressId: null,
        arrivalProgressId: null,
        arrivalWarehouseId: null,
        status: null,
        isTimeOut: null,
      };
      this.rePosts();
    },
    // 分页pageSize改变
    handleSizeChange(e) {
      this.pageSize = e;
      this.rePosts();
    },
    // 分页pageNum改变
    handleCurrentChange(e) {
      this.pageNum = e;
      this.getPost();
    },
    // 重新请求
    rePosts() {
      this.pageNum = 1;
      this.dataList = [];
      this.getPost();
    },
    // 表格列表
    getPost() {
      this.tableLoading = true;
      const params = {
        token: this.$store.state.token,
        pageNum: this.pageNum,
        pageSize: this.pageSize,
      };
      if (this.searchForm.keyword) {
        params.keyword = this.searchForm.keyword;
      }
      if (this.searchForm.cateIds) {
        params.cateIds = this.searchForm.cateIds;
      }
      if (this.searchForm.areaId) {
        params.areaId = this.searchForm.areaId;
      }
      if (this.searchForm.businessId) {
        params.businessId = this.searchForm.businessId;
      }
      if (this.searchForm.executionProgressId) {
        params.executionProgressId = this.searchForm.executionProgressId;
      }
      if (this.searchForm.arrivalProgressId) {
        params.arrivalProgressId = this.searchForm.arrivalProgressId;
      }
      if (this.searchForm.arrivalWarehouseId) {
        params.arrivalWarehouseId = this.searchForm.arrivalWarehouseId;
      }
      if (this.searchForm.status) {
        params.status = this.searchForm.status;
      }
      if (this.searchForm.isTimeOut) {
        params.isTimeOut = this.searchForm.isTimeOut;
      }

      if (this.searchChooseProjectId) {
        params.projectId = this.searchChooseProjectId;
      }
      if (this.modelStatus) {
        params.status = this.modelStatus;
      }
      APIProject.getProjectManageList(params).then((res) => {
        if (res.key === 1000) {
          res = res.result;
          this.parentTotalNum = res.data;
          this.total = res.count;
          res.list.forEach((item) => {
            if (item.checkTime) {
              item.checkDate = this.formatterTime(item.checkTime);
            }
            if (item.finalTime) {
              item.finalDate = this.formatterTime(item.finalTime);
            }
            if (item.createTime) {
              item.createDate = this.formatterTime(item.createTime);
            }
            if (item.cateIds) {
              let list = [];
              let cateIdList = item.cateIds.split(",");
              cateIdList.forEach((item) => {
                list.push(parseInt(item));
              });
              item.cateIdList = list;
            }
            if (item.areaId) {
              let list = [];
              let idList = item.areaId.split(",");
              idList.forEach((item) => {
                list.push(parseInt(item));
              });
              item.areaIds = list;
            }
          });
          this.dataList = res.list;
          this.tableLoading = false;
        }
      });
    },
    handleCurrentChangeOnline(e) {
      this.pageNumOnline = e;
      this.getOnlinePost();
    },
    rePostsOnline() {
      this.pageNumOnline = 1;
      this.dataOnlineList = [];
      this.getOnlinePost();
    },
    getOnlinePost() {
      this.$bus.$emit("show-loading", true);
      const params = {
        token: this.$store.state.token,
        pageNum: this.pageNumOnline,
        pageSize: this.pageSizeOnline,
      };
      if (this.searchLineForm.keyword) {
        params.keyword = this.searchLineForm.keyword;
      }
      if (this.searchLineForm.userType) {
        params.userType = this.searchLineForm.userType;
      }
      APIMedium.getMediumOnlineList(params).then((res) => {
        if (res.key === 1000) {
          this.totalOnline = res.result.count;
          res = res.result.list;
          res.forEach((item) => {
            if (this.chooseOnlineList && this.chooseOnlineList.length > 0) {
              this.chooseOnlineList.forEach((item1) => {
                if (item1.id === item.id) {
                  item.chooseNum = item1.chooseNum;
                }
              });
            }
          });
          this.dataOnlineList = res;
        }
        this.$bus.$emit("show-loading", false);
      });
    },
    handleCurrentChangeOffline(e) {
      this.pageNumOffline = e;
      this.getOfflinePost();
    },
    rePostsOffline() {
      this.pageNumOffline = 1;
      this.dataOfflineList = [];
      this.getOfflinePost();
    },
    getOfflinePost() {
      this.$bus.$emit("show-loading", true);
      const params = {
        token: this.$store.state.token,
        pageNum: this.pageNumOffline,
        pageSize: this.pageSizeOffline,
      };
      if (this.searchLineForm.offlineKeyword) {
        params.keyword = this.searchLineForm.offlineKeyword;
      }
      if (this.searchLineForm.offlineType) {
        params.offlineType = this.searchLineForm.offlineType;
      }
      APIMedium.getMediumOfflineList(params).then((res) => {
        if (res.key === 1000) {
          this.totalOffline = res.result.count;
          res = res.result.list;
          res.forEach((item) => {
            if (item.startTime) {
              item.createDate = this.$moment(item.startTime).format(
                "YYYY-MM-DD"
              );
            }
            if (item.expirationTime) {
              item.expirationDate = this.$moment(item.expirationTime).format(
                "YYYY-MM-DD"
              );
            }
            if (this.chooseOfflineList && this.chooseOfflineList.length > 0) {
              this.chooseOfflineList.forEach((item1) => {
                if (item1.id === item.id) {
                  item.chooseNum = item1.chooseNum;
                }
              });
            }
          });
          this.dataOfflineList = res;
        }
        this.$bus.$emit("show-loading", false);
      });
    },
    getSysLabel20() {
      this.$bus.$emit("show-loading", true);
      const params = {
        token: this.$store.state.token,
        sysLabelIds: "20",
      };
      APISysLabel.getSysLabelValueManageList(params).then((res) => {
        if (res.key === 1000) {
          this.offlineTypeList = res.result.data[20];
        }
        this.$bus.$emit("show-loading", false);
      });
    },
    getSysLabel21() {
      this.$bus.$emit("show-loading", true);
      const params = {
        token: this.$store.state.token,
        sysLabelIds: "21",
      };
      APISysLabel.getSysLabelValueManageList(params).then((res) => {
        if (res.key === 1000) {
          this.onlineUserType = res.result.data[21];
        }
        this.$bus.$emit("show-loading", false);
      });
    },
    searchTimeOut() {
      this.btnStatus = !this.btnStatus;
      if (this.btnStatus == true) {
        this.searchForm.isTimeOut = 2;
      } else {
        this.searchForm.isTimeOut = null;
      }
      this.getPost();
    },

    checkedFile(obj) {
      let that = this;
      let url = `/checkorder/manager/pc/user/importExcel?token=${this.$store.state.token}`;
      this.projectFile = obj.file;
      const formData = new FormData();
      formData.append("file", obj.file); //file 和 后端字段要保持一致
      formData.append("token", this.$store.state.token);
      //formData.append("fileType",this.upform.fileType);
      formData.append("projectId",this.chooseProjectId);
      const config = {
        headers: {
          "Access-Control-Allow-Origin": "*",
          token: this.$store.state.token,
        },
        timeout: 1000 * 60 * 10, //这里2分钟内的配置是生效的，超过了就不行。。
      };
      const loading = this.$loading({
        lock: true,
        text: "导入中，若数据量过大，则时间较长，在此期间请勿操作，请等待......",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      return axios
        .post(url, formData, config)
        .then((rs) => {
          if (rs.status === 200) {
            let data = rs.data;
            if (data.key === 1000) {
              that.$message.success({
                showClose: true,
                message: "上传成功",
                duration: 1500,
              });
              that.goodList = [];
              let goodList = data.result.list;

              if (this.upform.fileType == 1) {
                goodList.forEach((item) => {
                  item.totalPrice = (item.goodNum * item.goodPrice).toFixed(2);
                });
              } else if (this.upform.fileType == 2) {
                goodList.forEach((item) => {
                  item.totalPrice = (item.num * item.price).toFixed(2);
                });
              } else if (this.upform.fileType == 3) {
                goodList.forEach((item) => {
                  item.totalPrice = (item.num * item.price).toFixed(2);
                });
              }
              that.goodList = goodList;
            } else {
              that.$message({
                type: "warning",
                message: rs.data.message,
              });
            }
          } else {
            that.$message({
              type: "warning",
              message: rs,
            });
          }
          loading.close();
        })
        .catch((rs) => {
          loading.close();
          this.$message({
            type: "error",
            message: rs,
          });
        });
    },
    handleSave() {
      this.$refs.upform.validate((valid) => {
        if (!valid) {
          this.$message({
            type: "warning",
            message: "请检查上面输入项",
          });
          return;
        }
        if (!this.goodList || this.goodList.length < 1) {
          this.$message({
            type: "warning",
            message: "请上传文件",
          });
          return;
        }
        this.$bus.$emit("show-loading", true);
        const params = {
          projectId: this.chooseProjectId,
         // fileType: this.form.fileType,
          goods: JSON.stringify(this.goodList),
        };
       
        if (!params.projectId) {
          APIOrder.sendOrderUpdate(params, "application/json").then((res) => {
            if (res.key === 1000) {
              this.goodList = [];
            }
            this.$bus.$emit("show-loading", false);
          });
        } else {
          APIOrder.sendOrder(params, "application/json").then((res) => {
            if (res.key === 1000) {
              //this.submitProjectFile()
              this.$message.success(res.message);
             // this.$emit('get-stage');
              this.dialogVisible = false;
            }
            this.$bus.$emit("show-loading", false);
          });
        }
      });
    },
       getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      let sumColums = [];
      if (this.upform.fileType == 1) {
        sumColums = ["goodNum", "goodPrice", "totalPrice"];
      } else if (this.upform.fileType == 2) {
        sumColums = ["num", "price", "totalPrice"];
      } else if (this.upform.fileType == 3) {
        sumColums = ["num", "price", "totalPrice"];
      }
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (
          !values.every((value) => isNaN(value)) &&
          sumColums.includes(column.property)
        ) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += " 元";
        } else {
          sums[index] = "";
        }
      });
      return sums;
    },

    //跳转到项目详情
    handlego(projectId) {
      this.$router.push({
        name: "ProjectDetail",
        params: { projectId: projectId },
      });
    },
  },
};
</script>

<style lang="sass">
.avatar-uploader
    .el-upload-dragger
      border: 1px dashed #d9d9d9
      border-radius: 6px
      cursor: pointer
      position: relative
      overflow: hidden
      width: 100px !important
      height: 100px !important
      &:hover
        border-color: #409eff
      .avatar-uploader-icon
        font-size: 28px
        color: #8c939d
        width: 100px
        height: 100px
        line-height: 100px !important
        text-align: center
      .avatar
        width: 100px
        height: 100px
        display: block
</style>
<style lang="sass" scoped>
.global-operation-list
  padding-left: 0
.global-select .global-select-btn
  background: #FFFFFF
.global-table-content
  padding: 0
  background-color: white
  width: 100%
.global-table-content-a
  margin: 0 auto
  width: 90%
  padding: 20px 0
.company-user-list
  //@include container
  .isStatus1
    width: 41px
    height: 21px
    background: #F1FFFC
    border-radius: 3px
    border: 1px solid #03C192
    font-size: 14px!important
    color: #03C192!important
    line-height: 21px
    text-align: center
  .isStatus2
    width: 41px
    height: 21px
    background: #FFF2F2
    border-radius: 3px
    border: 1px solid #F46565
    font-size: 14px!important
    color: #F44141!important
    line-height: 21px
    text-align: center
  .global-operation-left
    margin-right: 0
  ::v-deep .permission-dialog
    .el-dialog__body
      display: flex
      align-items: center
      flex-direction: column
      padding: 30px 60px
      .permission-dialog-tree
        width: 100%
        max-height: 450px
        overflow-y: auto
        overflow-x: hidden
        margin-bottom: 40px
  .global-table
    display: flex
    align-items: center
    justify-content: center
    flex-direction: column
    .list
      background: #FFFFFF
      box-shadow: 0px 0px 10px 0px rgba(93, 139, 198, 0.05)
      border-radius: 14px
      margin-bottom: 15px
      width: 100%
      display: flex
      align-items: center
      justify-content: space-between
      padding: 19px 24px
      .left
        display: flex
        align-items: center
        .img
          width: 90px
          height: 90px
          border-radius: 4px
          margin-right: 17px
        .nav
          .text1
            font-size: 20px
            font-weight: bold
            color: #222222
            line-height: 26px
            display: flex
            align-items: center
            justify-content: flex-start
            margin-bottom: 16px
            span
              height: 16px
              background: #FFF8ED
              border-radius: 11px
              border: 1px solid #FF9901
              font-size: 12px
              color: #FF9901
              line-height: 16px
              padding: 0 8px
              display: block
              text-align: center
              margin-left: 11px
          .text2
            display: flex
            align-items: center
            justify-content: flex-start
            margin-bottom: 25px
            i
              font-size: 20px
              color: #1861FD
              margin-right: 7px
            .text2_1
              font-size: 14px
              color: #222222
              line-height: 19px
              margin-right: 7px
            .text2_2
              margin-left: 5px
              font-size: 23px
              font-weight: bold
              color: #222222
              line-height: 29px
              margin-right: 3px
            .text2_3
              font-size: 14px
              color: #B5B5C3
              line-height: 19px
          .text3
            display: flex
            align-items: center
            i
              font-size: 14px
              color: #B5B5C3
              margin-right: 5px
            div
              font-size: 14px
              color: #B5B5C3
              line-height: 19px
              margin-right: 80px
      .right
//.permission-dialog-item
//  background: #f2f2f2
</style>
